package cn.cdiothree.vo;


import lombok.Data;

/**
 * 新闻结果VO
 * @author cumthing
 */
@Data
public class NewsResultVo {

    private Integer newscode;
    private String newsmsg;
    private Object newsdata;

    public static NewsResultVo success(Object object) {
        NewsResultVo newsResultVO = new NewsResultVo();
        newsResultVO.setNewscode(0);
        newsResultVO.setNewsmsg("成功");
        newsResultVO.setNewsdata(object);
        return newsResultVO;
    }

    public static NewsResultVo success(Object object, String msg) {
        NewsResultVo newsResultVO = new NewsResultVo();
        newsResultVO.setNewscode(0);
        newsResultVO.setNewsmsg(msg);
        newsResultVO.setNewsdata(object);
        return newsResultVO;
    }

    public static NewsResultVo success(Integer code, String msg) {
        NewsResultVo newsResultVO = new NewsResultVo();
        newsResultVO.setNewscode(code);
        newsResultVO.setNewsmsg(msg);
        return newsResultVO;
    }

    public static NewsResultVo success() {
        return success(null);
    }

    public static NewsResultVo error(Integer code, String msg) {
        NewsResultVo newsResultVO = new NewsResultVo();
        newsResultVO.setNewscode(code);
        newsResultVO.setNewsmsg(msg);
        return newsResultVO;
    }


    public static ResultVo error(Object object) {
        ResultVo resultVO = new ResultVo();
        resultVO.setCode(1);
        resultVO.setMsg("出错就返回这种");
        resultVO.setData(object);
        return resultVO;
    }
}
